<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>枫叶商城 - 我的购物车</title>
    <meta name="description" content="枫叶商城" />
    <meta name="Keywords" content="枫叶商城" />
    <!-- 引入facicon.ico网页图标 -->
    <link rel="shortcut icon" href="./../images/logo.ico" type="image/x-icon" />
    <!-- 引入shoppingCart css -->
    <link rel="stylesheet" href="./../css/shoppingCart.css">
    <!-- 先引入jquery  -->
    <script src="./../plugin/jQuery/jquery-3.6.0.js"></script>
    <!-- 在引入我们自己的js文件 -->
    <script src="./../js/shoppingCart.js"></script>
    <script src="../plugin/axios.min.js"></script>
    <script src="../plugin/vue.min.js"></script>

</head>

<body>
    <div id="app">
        <div class="car-header">
            <div class="w">
                <div class="car-logo">
                    <a href="./../index.html"><img src="./../images/logo_maple2.png" alt="">
                        <div class="logo-font">Maple Leaf</div>
                    </a>
                </div>
            </div>
        </div>

    </div>
    <div class="c-container">
        <div class="w">
            <div class="cart-filter-bar">
                <em>全部商品</em>
            </div>
            <!-- 购物车主要核心区域 -->
            <div class="cart-warp">
                <!-- 头部全选模块 -->
                <div class="cart-thead">
                    <div class="t-checkbox">
                        <input type="checkbox" name="" id="" class="checkall"> 全选
                    </div>
                    <div class="t-goods">商品</div>
                    <div class="t-price">单价</div>
                    <div class="t-num">数量</div>
                    <div class="t-sum">小计</div>
                    <div class="t-action">操作</div>
                </div>
                <!-- 商品详细模块 -->
                <div class="cart-item-list">
                </div>

                <!-- 结算模块 -->
                <div class="cart-floatbar">
                    <div class="select-all">
                        <input type="checkbox" name="" id="" class="checkall">全选
                    </div>
                    <div class="operation">
                        <a href="javascript:;" class="remove-batch"> 删除选中的商品</a>
                        <a href="javascript:;" class="clear-all">清理购物车</a>
                    </div>
                    <div class="toolbar-right">
                        <div class="amount-sum">已经选<em>0</em>件商品</div>
                        <div class="price-sum">总价： <em>￥0</em></div>
                        <button class="btn-area">去结算</button>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <!-- footer start -->
    <div class="footer">
        <div class="w">
            <!-- mod_copyright  -->
            <div class="mod_copyright">
                <p>Copyright © 2022 深圳技师学院枫叶小组（Maple Leaf Group） 版权所有</p>
                <br>
                <p>项目研发小组所在地址：深圳市龙岗区龙城街道将军帽路深圳技师学院</p>
            </div>
        </div>
    </div>
    <!-- footer end -->
    </div>


    <script>
        let addGoodsList = JSON.parse(localStorage.getItem("addGoods"))

        const cardList = $(".cart-item-list")

        // if(localStorage.getItem("user_phone")){
            addGoodsList.forEach(element => {
                let template = `
                    <div class="cart-item">
                        <div class="p-checkbox">
                            <input type="checkbox" name="" id="" class="j-checkbox">
                        </div>
                        <div class="p-goods">
                            <div class="p-img">
                                <img src="../upload/${element.image}" alt="">
                            </div>
                            <div class="p-msg">${element.name}</div>
                        </div>
                        <div class="p-price">￥${element.amount}</div>
                        <div class="p-num">
                            <div class="quantity-form">
                                <a href="javascript:;" class="decrement">-</a>
                                <input type="text" class="itxt" value="1">
                                <a href="javascript:;" class="increment">+</a>
                            </div>
                        </div>
                        <div class="p-sum">￥${element.amount}</div>
                        <div class="p-action"><a href="javascript:;">删除</a></div>
                    </div>
            `
                cardList.append(template);
            });
        // }   
    </script>
    <!-- <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    goodsList: [],
                    goods: [
                        {
                            id: this.goodsList.id,
                            name: this.goodsList.name
                        }
                    ]
                }
            },
            methods: {
                goodsRender() {
                    axios({
                        method: 'GET',
                        url: 'http://localhost:8080/shopping/list',
                        params: { current: 1, size: 12 }
                    }).then((res) => {
                        console.log(res) 
                        console.log(res.data.data.records[0]);
                        
                        this.goodsList.push(res.data.data.records[0]);
                        console.log(this.goodsList.id);
                        console.log(this.goods);
                    })
                }
            },
            mounted() {
                this.goodsRender();
            }
        })
    </script> -->
</body>

</html>